#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int, int>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define pll pair<ll, ll>

void solve(){
    int n, x, mn = 0x3f3f3f3f, mx = -0x3f3f3f3f;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    	mx = max(mx, a[i]);
    	mn = min(mn, a[i]);
    }
    cin >> x;
    if(x >= mn && x <= mx){
    	cout << "YES" << '\n';
    }
    else cout << "NO" << '\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}